package com.jetinno.utils;


/**
 * Created by zhangyuncai.
 * Date: 2022/10/14
 */
//分类 0:免费 1:二维码 2:MDB现金 3:RFID刷卡 4:反扫  5:MDB刷卡 6:刷脸 7:取货码 8:万能码,已废弃 9:MDB刷卡(本质和MDB现金是一样的,仅仅是给售卖页面用的)
public enum Cate {
    FREE(0, "free"),
    QRCODE(1, null),
    MDBCASH(2, "mdb_cash"),
    RFID(3, null),
    BAR(4, null),
    VX820(5, null),//VX820
    FACE(6, "wxfacepay"),
    PICKCODE(7, "fastcode"),
    _Deprecated_Deprecated(8, null),
    MDBCASHLESS(9, "mdb_cashless"),
    TIANLONG(10, "tianlong_pay"),
    BEIYINMEI(11, "bym_pay"),
    REMOTE_FREE(12, "remote_production"); // 远程制作免费产品

    private final int cateId;
    private final String payTypeName;//当仅有一种支付时的支付代号

    Cate(int cateId, String payTypeName) {
        this.cateId = cateId;
        this.payTypeName = payTypeName;
    }

    public String getPayTypeName() {
        return payTypeName;
    }

    public int getCateId() {
        return cateId;
    }

    /**
     * 获取分类
     *
     * @param cateId
     * @return
     */
    public static Cate findCate(int cateId) {
        for (Cate value : Cate.values()) {
            if (value.getCateId() == cateId) {
                return value;
            }
        }
        return null;
    }

    ///是否是认可的支付大类
    public static boolean isCate(int cateId) {
        if (cateId == 8) {//APP中没有开放该大类支付
            return false;
        }
        for (Cate value : values()) {
            if (value.cateId == cateId) {
                return true;
            }
        }
        return false;
    }
}
